package com.bohua.child.controller;

import com.bohua.child.common.Lay;
import com.bohua.child.common.Msg;
import com.bohua.child.entity.Leave;
import com.bohua.child.service.LeaveService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
/**
 * 请假表控制器
 * @author shichenyang
 * @email gyv12345@163.com
 * @date 2019/01/17
 */
@Controller
@RequestMapping("/leave")
public class LeaveController {
    @Resource
    private LeaveService leaveService;

    @RequestMapping
    public String leave(){
        return "leave/leave.html";
    }
    @RequestMapping("/add")
    public String add(){
        return "leave/addLeave.html";
    }

    @RequestMapping("/update")
    public String update(){
        return "leave/updateLeave.html";
    }

    @RequestMapping("/getLeaves")
    @ResponseBody
    public Lay getLeaves(Leave leave,Integer page,Integer limit){
        return leaveService.getLeaves(leave,page,limit);
    }
    @RequestMapping("/addLeave")
    @ResponseBody
    public Msg addLeave(Leave leave){
        return leaveService.addLeave(leave);
    }

    @RequestMapping("/updateLeave")
    @ResponseBody
    public Msg updateLeave(Leave leave){
        return leaveService.updateLeave(leave);
    }

    @RequestMapping("/delLeave")
    @ResponseBody
    public Msg delLeave(Leave leave){
        return leaveService.delLeave(leave);
    }
}
